-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opensearch - Remove CurrentState attribute #2162
base: main
Are you sure you want to change the base?
opensearch - Remove CurrentState attribute #2162
Conversation
This is necessary because describe_domain_config method returns both CurrentState and DesiredState while update_domain_config method only expects DesiredState.
Build succeeded. ❌ ansible-galaxy-importer FAILURE in 5m 21s (non-voting) |
Can you also please add an integration test that covers this case? https://github.com/ansible-collections/community.aws/tree/main/tests/integration/targets/opensearch Otherwise LGTM |
@markuman, as far as I can tell, integration tests for I'm fairly certain the existing tests would catch it by failing. I'm not exactly sure when this piece of Opensearch functionality was introduced. I suspect it happened between April 25, 2024 (which is the most recent successful build of my Ansible automation that touched Opensearch) and now. |
@markuman, any luck with the testing? |
@markuman, any luck with this? |
The current integration test does not work anymore and need more care. diff --git a/tests/integration/targets/opensearch/defaults/main.yml b/tests/integration/targets/opensearch/defaults/main.yml
index da6aef4b..03a5e04f 100644
--- a/tests/integration/targets/opensearch/defaults/main.yml
+++ b/tests/integration/targets/opensearch/defaults/main.yml
@@ -1,2 +1,5 @@
---
# defaults file for opensearch tests
+min_engine_version: OpenSearch_1.3
+default_engine_version: OpenSearch_2.17
+tls_version: Policy-Min-TLS-1-2-2019-07
diff --git a/tests/integration/targets/opensearch/tasks/test_opensearch.yml b/tests/integration/targets/opensearch/tasks/test_opensearch.yml
index 7ce1f8d9..42466155 100644
--- a/tests/integration/targets/opensearch/tasks/test_opensearch.yml
+++ b/tests/integration/targets/opensearch/tasks/test_opensearch.yml
@@ -2,7 +2,7 @@
block:
- name: test without specifying required module options
opensearch:
- engine_version: "Elasticsearch_7.1"
+ engine_version: "{{ min_engine_version }}"
ignore_errors: true
register: result
@@ -15,7 +15,7 @@
opensearch:
state: present
domain_name: "es-{{ tiny_prefix }}-public"
- engine_version: "OpenSearch_1.1"
+ engine_version: "{{ default_engine_version }}""
cluster_config:
instance_type: "t2.small.search"
instance_count: 2
@@ -41,7 +41,7 @@
state: present
# Note domain_name must be less than 28 characters and satisfy regex [a-z][a-z0-9\\-]+
domain_name: "es-{{ tiny_prefix }}-public"
- engine_version: "OpenSearch_1.1"
+ engine_version: "{{ default_engine_version }}""
cluster_config:
instance_type: "t2.small.search"
instance_count: 2
@@ -66,7 +66,7 @@
- assert:
that:
- "opensearch_domain.tags | length == 4"
- - "opensearch_domain.engine_version == 'OpenSearch_1.1'"
+ - "opensearch_domain.engine_version == default_engine_version"
- "opensearch_domain.cluster_config.instance_count == 2"
- "opensearch_domain.cluster_config.instance_type == 't2.small.search'"
- "opensearch_domain.cluster_config.dedicated_master_enabled == false"
@@ -88,7 +88,7 @@
opensearch:
state: present
domain_name: "es-{{ tiny_prefix }}-public"
- engine_version: "OpenSearch_1.1"
+ engine_version: "{{ default_engine_version }}""
cluster_config:
instance_type: "t2.small.search"
instance_count: 2
@@ -112,7 +112,7 @@
opensearch:
state: present
domain_name: "es-{{ tiny_prefix }}-public"
- engine_version: "OpenSearch_1.1"
+ engine_version: "{{ default_engine_version }}""
cluster_config:
instance_type: "t2.small.search"
instance_count: 2
@@ -135,7 +135,7 @@
opensearch:
state: present
domain_name: "es-{{ tiny_prefix }}-vpc"
- engine_version: "Elasticsearch_7.1"
+ engine_version: "{{ min_engine_version }}"
cluster_config:
instance_type: "m5.large.search"
instance_count: 2
@@ -179,7 +179,7 @@
opensearch:
state: present
domain_name: "es-{{ tiny_prefix }}-vpc"
- engine_version: "Elasticsearch_7.1"
+ engine_version: "{{ min_engine_version }}"
cluster_config:
instance_type: "m5.large.search"
instance_count: 2
@@ -241,7 +241,7 @@
opensearch:
state: present
domain_name: "es-{{ tiny_prefix }}-vpc"
- engine_version: "Elasticsearch_7.1"
+ engine_version: "{{ min_engine_version }}"
cluster_config:
instance_type: "m5.large.search"
instance_count: 2
@@ -281,7 +281,7 @@
opensearch:
state: present
domain_name: "es-{{ tiny_prefix }}-vpc"
- engine_version: "Elasticsearch_7.1"
+ engine_version: "{{ min_engine_version }}"
cluster_config:
instance_type: "m5.large.search"
instance_count: 2
@@ -932,7 +932,7 @@
domain_name: "es-{{ tiny_prefix }}-vpc"
domain_endpoint_options:
enforce_https: true
- tls_security_policy: "Policy-Min-TLS-1-0-2019-07"
+ tls_security_policy: "{{ tls_version }}"
wait: true
check_mode: true
register: opensearch_domain
@@ -945,7 +945,7 @@
domain_name: "es-{{ tiny_prefix }}-vpc"
domain_endpoint_options:
enforce_https: true
- tls_security_policy: "Policy-Min-TLS-1-0-2019-07"
+ tls_security_policy: "{{ tls_version }}"
# Refer to CNAME that was defined in the previous tasks.
custom_endpoint_enabled: true
custom_endpoint: "opensearch.ansible-integ-test.com"
@@ -966,7 +966,7 @@
- assert:
that:
- "opensearch_domain.domain_endpoint_options.enforce_https == True"
- - "opensearch_domain.domain_endpoint_options.tls_security_policy == 'Policy-Min-TLS-1-0-2019-07'"
+ - "opensearch_domain.domain_endpoint_options.tls_security_policy == tls_version"
#- "opensearch_domain.domain_endpoint_options.custom_endpoint_enabled == True"
- opensearch_domain is changed
However, the integration test is still failing at:
So some of the principals defined here must be wrong: https://github.com/ansible-collections/community.aws/blob/main/tests/integration/targets/opensearch/templates/kms_policy.j2 |
SUMMARY
This is necessary because
describe_domain_config
method returns bothCurrentState
andDesiredState
whileupdate_domain_config
method only expectsDesiredState
.Fixes #2161.
ISSUE TYPE
COMPONENT NAME
opensearch
ADDITIONAL INFORMATION